/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "clie_has_moto")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ClieHasMoto.findAll", query = "SELECT c FROM ClieHasMoto c"),
    @NamedQuery(name = "ClieHasMoto.findByIdCliehasMoto", query = "SELECT c FROM ClieHasMoto c WHERE c.idCliehasMoto = :idCliehasMoto"),
    @NamedQuery(name = "ClieHasMoto.findByPatenteMoto", query = "SELECT c FROM ClieHasMoto c WHERE c.patenteMoto = :patenteMoto"),
    @NamedQuery(name = "ClieHasMoto.findByNumBastidor", query = "SELECT c FROM ClieHasMoto c WHERE c.numBastidor = :numBastidor"),
    @NamedQuery(name = "ClieHasMoto.findByAno", query = "SELECT c FROM ClieHasMoto c WHERE c.ano = :ano"),
    @NamedQuery(name = "ClieHasMoto.findByKilometraje", query = "SELECT c FROM ClieHasMoto c WHERE c.kilometraje = :kilometraje"),
    @NamedQuery(name = "ClieHasMoto.findByColor", query = "SELECT c FROM ClieHasMoto c WHERE c.color = :color")})
public class ClieHasMoto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Clie_has_Moto")
    private Integer idCliehasMoto;
    @Size(max = 45)
    @Column(name = "Patente_Moto")
    private String patenteMoto;
    @Size(max = 45)
    @Column(name = "Num_Bastidor")
    private String numBastidor;
    @Column(name = "Ano")
    private Integer ano;
    @Column(name = "Kilometraje")
    private BigInteger kilometraje;
    @Size(max = 45)
    @Column(name = "Color")
    private String color;
    @JoinColumn(name = "id_Ficha_Tecnina", referencedColumnName = "id_Ficha_Tecnina")
    @ManyToOne
    private FichaTecnica idFichaTecnina;
    @JoinColumn(name = "Rut_Clie", referencedColumnName = "Rut_Clie")
    @ManyToOne(optional = false)
    private Clientes rutClie;
    @JoinColumn(name = "id_Moto", referencedColumnName = "id_Moto")
    @ManyToOne(optional = false)
    private Moto idMoto;
    @OneToMany(mappedBy = "idCliehasMoto")
    private Collection<OrdenTrabajo> ordenTrabajoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliehasMoto")
    private Collection<FotosClieMoto> fotosClieMotoCollection;

    public ClieHasMoto() {
    }

    public ClieHasMoto(Integer idCliehasMoto) {
        this.idCliehasMoto = idCliehasMoto;
    }

    public Integer getIdCliehasMoto() {
        return idCliehasMoto;
    }

    public void setIdCliehasMoto(Integer idCliehasMoto) {
        this.idCliehasMoto = idCliehasMoto;
    }

    public String getPatenteMoto() {
        return patenteMoto;
    }

    public void setPatenteMoto(String patenteMoto) {
        this.patenteMoto = patenteMoto;
    }

    public String getNumBastidor() {
        return numBastidor;
    }

    public void setNumBastidor(String numBastidor) {
        this.numBastidor = numBastidor;
    }

    public Integer getAno() {
        return ano;
    }

    public void setAno(Integer ano) {
        this.ano = ano;
    }

    public BigInteger getKilometraje() {
        return kilometraje;
    }

    public void setKilometraje(BigInteger kilometraje) {
        this.kilometraje = kilometraje;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public FichaTecnica getIdFichaTecnina() {
        return idFichaTecnina;
    }

    public void setIdFichaTecnina(FichaTecnica idFichaTecnina) {
        this.idFichaTecnina = idFichaTecnina;
    }

    public Clientes getRutClie() {
        return rutClie;
    }

    public void setRutClie(Clientes rutClie) {
        this.rutClie = rutClie;
    }

    public Moto getIdMoto() {
        return idMoto;
    }

    public void setIdMoto(Moto idMoto) {
        this.idMoto = idMoto;
    }

    @XmlTransient
    public Collection<OrdenTrabajo> getOrdenTrabajoCollection() {
        return ordenTrabajoCollection;
    }

    public void setOrdenTrabajoCollection(Collection<OrdenTrabajo> ordenTrabajoCollection) {
        this.ordenTrabajoCollection = ordenTrabajoCollection;
    }

    @XmlTransient
    public Collection<FotosClieMoto> getFotosClieMotoCollection() {
        return fotosClieMotoCollection;
    }

    public void setFotosClieMotoCollection(Collection<FotosClieMoto> fotosClieMotoCollection) {
        this.fotosClieMotoCollection = fotosClieMotoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCliehasMoto != null ? idCliehasMoto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClieHasMoto)) {
            return false;
        }
        ClieHasMoto other = (ClieHasMoto) object;
        if ((this.idCliehasMoto == null && other.idCliehasMoto != null) || (this.idCliehasMoto != null && !this.idCliehasMoto.equals(other.idCliehasMoto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.ClieHasMoto[ idCliehasMoto=" + idCliehasMoto + " ]";
    }
    
}
